package controllers

import (
	"github.com/astaxie/beego"
	"jujiu/biz"
	"log"
)

type VaryagController struct {
	beego.Controller
}

/**
获取集群基本信息
 */
func (v *VaryagController) ClusterInfo() {
	cid := v.GetString("cid")
	if cid == "" {
		log.Println("获取参数错误！")
		v.Ctx.WriteString("参数为空")
		return
	}
	if !(cid == "Hangzhou" || cid == "Frankfurt") {
		v.Ctx.WriteString("集群Id不正确")
		return
	}
	info := biz.GetClusterInfo(cid)
	v.Data["json"] = info
	v.ServeJSON()
	return
}

/**
获取节点连接session个数
 */
func (v *VaryagController) NodeSessionNum() {
	//num := biz.GetNodeSessionNum()
	//v.Ctx.WriteString(strconv.FormatInt(num, 10))
	return
}
